package com.caochenlei.graph;

public class DirectedCycleTest {
    public static void main(String[] args) {
        Digraph D = new Digraph(5);
        D.addEdge(3, 0);
        D.addEdge(0, 2);
        D.addEdge(2, 1);
        D.addEdge(1, 0);
        D.addEdge(1, 4);
        DirectedCycle cycle = new DirectedCycle(D);
        System.out.println("是否有环：" + cycle.hasCycle());
        System.out.println("====================");
        System.out.println(D);
    }
}
